//---------------------------------------------------------------------------

#ifndef TRosterHandlerH
#define TRosterHandlerH
#include "common.h"
//---------------------------------------------------------------------------
namespace WYHGloox{
class TRosterHandler : public RosterListener
{
  private:
	Client *_client;
  public:
	TRosterHandler(Client *client);
	virtual ~TRosterHandler();

	TOnItemSubscribed FOnItemSubscribed;
	TOnItemAdded FOnItemAdded;//jid.bare().c_str()
	TOnItemUnsubscribed FOnItemUnsubscribed;
	TOnItemRemoved FOnItemRemoved;
	TOnItemUpdated FOnItemUpdated;
	TOnRosterItem FOnRosterItem;
	TOnRosterError FOnRosterError;
	TOnRosterPresence FOnRosterPresence;
	TOnSelfPresence FOnSelfPresence;
	TOnSubscriptionRequest FOnSubscriptionRequest;
	TOnUnsubscriptionRequest FOnUnsubscriptionRequest;
	TOnNonrosterPresence FOnNonrosterPresence;

	virtual void handleItemSubscribed( const JID& jid );
	virtual void handleItemAdded( const JID& jid );//jid.bare().c_str()
	virtual void handleItemUnsubscribed( const JID& jid );
    virtual void handleItemRemoved( const JID& jid );
    virtual void handleItemUpdated( const JID& jid );
    virtual void handleRoster( const Roster& roster );
	virtual void handleRosterError( const IQ& iq );
	virtual void handleRosterPresence( const RosterItem& item, const std::string& resource,
									   Presence::PresenceType presence, const std::string& msg );
	virtual void handleSelfPresence( const RosterItem& item, const std::string& resource,
									   Presence::PresenceType presence, const std::string& msg );
    virtual bool handleSubscriptionRequest( const JID& jid, const std::string& msg );

	virtual bool handleUnsubscriptionRequest( const JID& jid, const std::string& msg );
	virtual void handleNonrosterPresence( const Presence& presence );
};
};
using namespace WYHGloox;
#endif
